When your Empire is fully developed you will rely on numerous ports and roads to form a vast transport web. Eventually, you will establish ports on other continents and build more road networks out from these new ports.
At the beginning of the game, however, the choice of reaching a vital terrain tile with a road, or building a port nearby, can be difficult.
Since ports cost the same as five tiles of road (five iron and five lumber), cost can give you a rough guideline when deciding what to do. Time is also an issue. It will take your engineer 2 turns to build a port and at least five turns to build five tiles of road. You should also consider the option of building a port near to a distant (inland) resource you need and then constructing a road from the new port to the resource. This can be less expensive and less time consuming than constructing a road all the way from your capital.